import { IndexDto, ShowDto } from '@libs/common/dto';
import { ApiProperty } from '@nestjs/swagger';
import { IsBoolean, IsNotEmpty, IsNumber, IsString } from 'class-validator';

import { Points } from '../entities/points.entity';

export class IndexPointsDto extends IndexDto<Points> {}

export class ShowPointsDto extends ShowDto {}

export class CreatePointsDto {
  @IsNotEmpty({ message: '用户ID不能为空' })
  userId: string;

  @IsNotEmpty({ message: '积分不能为空' })
  @IsNumber({}, { message: '积分必须是数字' })
  points: number;

  @IsString({ message: '描述必须是字符串' })
  @IsNotEmpty({ message: '描述不能为空' })
  desc: string;
}

export class SwitchPointsDto {
  @ApiProperty()
  @IsNotEmpty({ message: 'id 不能为空' })
  id: string;

  @ApiProperty({ description: '状态' })
  @IsNotEmpty({ message: '状态不能为空' })
  @IsBoolean()
  status: boolean;
}

export class ImportPointsDto {}

export class ExportPointsDto {}
export class CountPointsDto {
  @ApiProperty({ description: '用户ID' })
  @IsNotEmpty({ message: '用户ID不能为空' })
  userId: string;

  @ApiProperty({ description: '用户名称' })
  userName?: string;
}

export class FindPointsDto {
  @ApiProperty({ description: '用户ID' })
  userId: string;
}
